import {Describer} from "./base";


export class MinutePartDescriber extends Describer {
  singleNumberSegment(exp: string): string {
    return exp.padStart(2, '0') + '分';
  }

  spanSegment(exp: string): string {
    const {start, end} = super.parseSpan(exp)
    const startPadded = start.padStart(2, '0')
    const endPadded = end.padStart(2, '0')
    return `${startPadded}到${endPadded}分之间的每一分钟`;
  }

  spanSlashNumberSegment(exp: string): string {
    const {start, end, interval} = super.parseSpanSlashNumber(exp)
    const startPadded = start.padStart(2, '0')
    const endPadded = end.padStart(2, '0')

    return `${startPadded}到${endPadded}分之间每隔${interval}分钟`;
  }

  starSegment(exp: string): string {
    return "每分钟";
  }

  starSlashNumberSegment(exp: string): string {
    const interval = exp.replace('*/', '')
    return `每${interval}分钟`;
  }

}
